<?php
/**
* Copyright 2009 Waag Society <http://www.waag.org>
* This file is part of Annotrax.
*
* Annotrax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Annotrax is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Annotrax.
* If not, see http://www.gnu.org/licenses/gpl.html
*/

?>
<?php
class Admin_Form_MovieSelect extends Zend_Form{
	private $_movie;

	public function __construct( Default_Model_Movie $movie, $options = null ){
		parent::__construct( $option );

		$this->_movie 		= $movie;
		$this->setMethod( 'get' );

		$movie->setLimit(0);
		$movies = $movie->fetchAll();

		$options = array();

		foreach( $movies as $movie ){
			$options[$movie->id] = $movie->title;
		}

		$this->addElement( 'select', 'movie', array(
			'value'	=> $this->_movie->id,
			'multiOptions'	=> $options
		));

		$this->addElement( 'submit', 'Save', array(
			'label'	=> 'Select',
			'class'	=> 'floatLeft'
		));

		$elements = $this->getElements();

		foreach( $elements as $element ){
			$element->removeDecorator('DtDdWrapper');
			$element->removeDecorator('HtmlTag');
			$element->removeDecorator('Label');
		}
		$this->removeDecorator('HtmlTag');



        $this->addDisplayGroup( array_keys( $elements ), 'metadata', array(
            'legend' => 'Select a movie to view annotations'
        ));

	}
}
